import org.w3c.dom.Element;

public class Analysis extends TextElement
{
    /**
     * Score given by tagger.
     */
    double score;

    /**
     * The tag which corresponds to this analysis.
     */
    Tag tag;

    /**
     * Construct from DOM element.
     */
    public Analysis(Element analysisElement, Token parentToken) throws Exception
    {
        id = analysisElement.getAttribute("id");
        parent = parentToken;

        tag = Tag.GetFromXmlAnalysis(analysisElement);

        // Extract score
        String scoreString = analysisElement.getAttribute("score");
        if (scoreString.isEmpty())
            scoreString = "0";
        score = Float.parseFloat(scoreString);
    }
}
